// ++++++++++++++++++++++++++++++++++++++++
// 《零基础Go语言算法实战》源码
// ++++++++++++++++++++++++++++++++++++++++
// Author:廖显东（ShirDon）
// Blog:https://www.shirdon.com/
// Gitee:https://gitee.com/shirdonl/goAlgorithms.git
// Buy link :https://item.jd.com/14101229.html
// ++++++++++++++++++++++++++++++++++++++++

package main

import "fmt"

// 计算2个整数的最大公约数
func gcd2(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd2(b, a%b)
}

// 计算3个整数的最大公约数
func gcd3(a, b, c int) int {
	return gcd2(gcd2(a, b), c)
}

func main() {
	fmt.Println(gcd3(32, 16, 64))
}

//$ go run interview13-4.go
//16
